package com.example.zjx8969.myapplication.dialogManager

import android.content.DialogInterface
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager

open class QueueDialogImpByFragment(private val fragmentManagerOfParent: FragmentManager,
                                    override var listener: DialogInterface.OnDismissListener) : AbstractQueueDialog, Fragment() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

    }

    fun dismissDialog() {
        fragmentManagerOfParent.beginTransaction().remove(this).commitAllowingStateLoss()
        listener.onDismiss(null)
    }

    override fun showDialog(): Boolean {
        fragmentManagerOfParent.beginTransaction().add(this, javaClass.simpleName).commitAllowingStateLoss()
        return true
    }

}